#ifndef CONFIG_PROTOCOL_H
#define CONFIG_PROTOCOL_H


#define MAX_LINE  40
#define PORT  8888
#define LISTENEQ  5000


/* Fixed-size types, underlying types depend on word size and compiler.  */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int int16_t;
typedef unsigned short int uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;

/*定义服务器--客户端 消息传送类型*/
enum MessageType{
    VIDEO_LF = 0, /*请求左前微光*/
    VIDEO_F,	/*请求前微光视频播放*/
    VIDEO_RF, 	/*请求右前微光*/
    VIDEO_LB,		/*请求左后微光*/
    VIDEO_RB,	/*请求右后微光*/
    VIDEO_B,/*请求后微光*/
    VIDEO_DF,		/*请求前双目07*/
    VIDEO_DB,		/*请求后双08*/
    FRONT_PANO,    /*请求前全景09*/
    FRONT_LIGHT_PANO, /*请求前微光全景0a*/
    CAR_FORWARD_PANO, /*请求车前进行拼接（前全景）0b*/
    CAR_FORWARD_LIGHT_PANO, /*请求车前进行拼接（前微光全景）0c*/
    CAR_FORWARD_DF,  /*请求车前进行拼接（前双目）0d*/
    CAR_FORWARD_F, /*请求车前进行拼接（前微光）0e*/
    CAR_BACK_PANO,  /*请求车后进行拼接（后全景）0f*/
    CAR_BACK_LIGHT_PANO,  /*请求车后进行拼接（后微光全景）10*/
    INVALID,  /*无效模式*/
};

/*定义操作结果 */
enum StateRet{
    EXCEED, //已达服务器链接上限
    SUCCESS, //成功
    FAILED,  //失败
};

/*消息头*/
typedef  struct _MessageHead{
    uint16_t identifi;  //信息标识
    uint16_t length;
    uint16_t sequenceNum;//序号
    uint32_t time;//产生时刻
    uint32_t SourceIp; //源设备IP
    uint32_t ReceiverIp;  //目的设备IP
    uint16_t ConfirmSign; //确认标志
    uint16_t reserve;     //预留
}MessageHead;
/*定义服务器 -- 客户端 消息传送结构体*/
typedef struct _Message{
    MessageHead MsgHead;   //消息头
    uint8_t MsgType;	   /*消息类型 即为MessageType中的值*/
    uint8_t UploadFlag;   //上传标志
    uint8_t DataReserve[10]; //数据保留字段
    uint8_t EndReserve[3];
    uint8_t CheckCode;   //校验码
}Message;

//拼接位置枚举
enum PositionType{
    UP = 0,
    LEFT,
    MID,
    RIGHT,
    UP_LEFT, //左上
    UP_MID,  //中上
    UP_RIGHT, //右上
    DOWN_LEFT,  //左下
    DOWN_MID,   //中下
    DOWN_RIGHT, //右下
    LEFT_DOWN,  //左下二分之一
    RIGHT_DOWN, //右下二分之一
    FULL_SCREEN,
    MAX_TYPE,
};

#endif // CONFIG_PROTOCOL_H
